<template>
  <el-card>
    <div slot="header">
      <el-button style="float: right" size="small" @click="goBack"
        >返回</el-button
      >
      编辑资源分类
    </div>
    <CreateOrEditForm @suc="onSuc" :id="$route.params.id" @fatal="onFatal" />
  </el-card>
</template>
<script lang="ts">
import Vue from 'vue'
import CreateOrEditForm from './components/CreateOrEditForm.vue'
export default Vue.extend({
  name: 'resource-category-create',
  components: {
    CreateOrEditForm
  },
  methods: {
    goBack () {
      this.$router.push({ name: 'resource-category' })
    },
    onSuc () {
      this.$message.success('编辑成功')
      this.goBack()
    },
    onFatal () {
      this.$router.replace({ name: 'error-404' })
    }
  }
})
</script>
